<script>
export default {
	onLaunch: async function () {
		console.log('App Launch')

		try {
			const { data } = await uni.$openIM.getLoginStatus();
			console.log('登录状态', data);

			if (data == 1) { //未登录
				console.log('未登录');
				uni.$openIM.login({
					userID: '1101',
					token: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiIxMTAxIiwiUGxhdGZvcm1JRCI6NiwiZXhwIjoxNzUxNTQzNjk0LCJpYXQiOjE3NDM3Njc2ODl9.VkQ5WLjhyhDUHArIXwMJj1P_Gi6MoleXtFHFgVY2xso',
					platformID: 6,
					wsAddr: 'wss://openweb.51gzmj.cn/msg_gateway',
					apiAddr: 'https://openweb.51gzmj.cn/api',
				});
			} else {
				console.log('已登录');
			}
		} catch ({ errCode, errMsg }) {
			console.log('登录失败', errCode, errMsg);
		}
	},
	onShow: function () {
		console.log('App Show')
	},
	onHide: function () {
		console.log('App Hide')
	}
}
</script>

<style>
/*每个页面公共css */
</style>
